using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;

namespace UnitTest
{
    public static class NBehaveExtensions
    {
        public static void ShouldBeComposedOf<T>(this IEnumerable<T> enumerable, params T[] expectedValues)
        {
            var enumerableList = enumerable as IList<T> ?? enumerable.ToList();
            enumerableList.ShouldBeOfLength(expectedValues.Count());
            foreach (var expectedValue in expectedValues)
            {
                Assert.Contains(expectedValue, enumerableList.ToArray());
            }
        }

        public static void ShouldBeOfLength<T>(this IEnumerable<T> enumerable, int expectedLength)
        {
            Assert.AreEqual(enumerable.Count(), expectedLength);
        }
    }
}